#pragma once

namespace AVUI {

class Point3D;
class Rect3D;
class Vector3D;

class FaceType
{
public:
    enum Enum
    {
        None,
        Front,
        Back
    };
};


class LineUtil
{
public:

#pragma region Internal Methods

    static bool ComputeLineBoxIntersection(const Point3D& origin, const Vector3D& direction, const Rect3D& box, bool isRay);
    static bool ComputeLineTriangleIntersection(FaceType::Enum type, const Point3D& origin, const Vector3D& direction, const Point3D& v0, const Point3D& v1, const Point3D& v2, Point* pHitCoord, float* pDist);
    static void Transform(Matrix3D* pModelMatrix, Point3D* pOrigin, Vector3D* pDirection, bool* pIsRay);

#pragma endregion Internal Methods

#pragma region Private Methods

    static void ColumnsToAffinePointVector(float rgMatrix[4][2], int col1, int col2, Point3D* pOrigin, Vector3D* pDirection);
    static void ColumnsToAffinePointVector(float rgMatrix[4][4], int col1, int col2, Point3D* pOrigin, Vector3D* pDirection);
    static void FindSmallestTwoDiagonal(float rgMatrix[4][4], int* pEvec1, int* pEvec2);
    static void Square(float m[4][4], float numArray[4][4]);
    static void TransformedLineMatrix(const Matrix3D& modelMatrix, Point3D* pOrigin, Vector3D* pDirection, float numArray[4][4]);
    static void TransformSingular(const Matrix3D& modelMatrix, Point3D* pOrigin, Vector3D* pDirection);

#pragma endregion Private Methods

};


}; // namespace AVUI

